package com.lagou.service.impl;

import com.lagou.service.HelloService;
import org.apache.dubbo.config.annotation.Service;

/**
 * 消费端未设置超时时间，以服务端为准，否则，以消费端为准
 */
@Service
public class HelloServiceImpl implements HelloService {

    @Override
    public String sayHello(String name) throws InterruptedException {
        return "Hello " + name + "!";
    }

    @Override
    public String sayHelloA(String name) throws InterruptedException {
        /**
         * 随机休眠若干毫秒（0~100）
         */
        int i = (int) (Math.random() * 100);
        Thread.sleep(i);
        return "HelloA " + name + "!";
    }

    @Override
    public String sayHelloB(String name) throws InterruptedException {
        /**
         * 随机休眠若干毫秒（0~100）
         */
        int i = (int) (Math.random() * 100);
        Thread.sleep(i);
        return "HelloB " + name + "!";
    }

    @Override
    public String sayHelloC(String name) throws InterruptedException {
        /**
         * 随机休眠若干毫秒（0~100）
         */
        int i = (int) (Math.random() * 100);
        Thread.sleep(i);
        return "HelloC " + name + "!";
    }
}
